<include file="Public/header"/>
<div class="x-nav">
      <span class="layui-breadcrumb">

      </span>
  <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
    <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
  <div class="layui-row">
    <form class="layui-form layui-col-md12 x-so"  method="get">

      <div class="layui-input-inline">
        <select name="status" cstyle="margin-top:10px;">
          <option value="0">选择记录状态</option>
          <option value="1" <php>if(I('status') == 1) echo 'selected'</php>>申请退款</option>
          <option value="2" <php>if(I('status') == 2) echo 'selected'</php>>退款成功</option>
          <option value="3" <php>if(I('status') == 3) echo 'selected'</php>>拒绝退款</option>
        </select>
      </div>
   
      <input type="text" name="uid"  value="{:I('uid')}"  placeholder="请输入会员Id" autocomplete="off" class="layui-input" style="margin-top:10px;">
	  <input type="text" name="out_trade_no"  value="{:I('out_trade_no')}"  placeholder="请输入订单号" autocomplete="off" class="layui-input" style="margin-top:10px;">
      <button class="layui-btn" id="search"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
      <button class="layui-btn" id="export"  lay-submit="" lay-filter="" style="display:none"><i class="layui-icon">&#xe62f;</i></button>

    </form>
  </div>
  <xblock>
  	<button class="layui-btn layui-bg-red" onclick="delAll('','{:U('refunddel')}')"><i class="layui-icon"></i>永久删除</button>
  	<button class="layui-btn layui-bg-warm" onclick="issetAll('','{:U('is_AgreeRefund')}')">批量退款操作</button>
  	<button class="layui-btn layui-bg-blue" onclick="issetAll('','{:U('not_AgreeRefund')}')">批量拒绝操作</button>
    <span class="x-right" style="line-height:40px">共有数据：{$count} 条</span>
  </xblock>
  <table class="layui-table">
    <thead>
    <tr>
      <th>
        <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
      </th>
      <th>Id</th>
      <th>原订单号</th>
      <th >退款商品</th>
      <th>退款金额</th>
      <th>订单总金额</th>
      <th style="width:130px;">会员信息</th>
      <th>联系方式</th>
      <th>申请时间</th>
      <th>记录状态</th>
      <th>退款时间</th>
      <th style="width:100px;">处理说明</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <volist name="data" id="vo">
      <tr>
        <td>
        <if condition="$vo.status eq 1">
          <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='{$vo['id']}'><i class="layui-icon">&#xe605;</i></div>
		</if>
		</td>
		<td>{$vo['id']}</td>
		<td>{$vo['out_trade_no']}</td>
<td>
		<foreach name="vo['goodsinfo']" item="v">
		  	<img src="{$v['thumb']}" width="40"  border=0><br>
  			<a  onclick="x_admin_show('商品列表','{:U('goods/index',array('id'=>$v['id']))}')" >{$v['name']}<font color="red">￥{$v['tuan_price']}</font>
  			*{$v['num']}&nbsp;&nbsp;ID:{$v['id']}<br>
		</foreach>
		
<!-- 
		<img src="{$vo['thumb']}" width="40"><br>
  		<a  onclick="x_admin_show('商品列表','{:U('goods/index',array('id'=>$vo['sid']))}')" >{$vo['name']}&nbsp;&nbsp;ID:{$vo['sid']}<br>
    	</a>
 -->
</td>
<td>{$vo['jiner']}</td>
<td>{$vo['pay_jiner']}</td>
<td>
  <img src="{$vo['head']}" width="40" border=0>
  <br>
  {$vo['nickname']}

</td>
<td>
	{$vo["mobile"]}
</td>
<td>
	{$vo['addtime']|date="Y-m-d H:i",###}
</td>
<td>
  <if condition='$vo.status eq 1'>申请退款</if><if condition='$vo.status eq 2'>退款成功</if><if condition='$vo.status eq 3'>拒绝退款</if>
</td>
<td>
<if condition='$vo.updatetime neq "" or $vo.updatetime neq null'>{$vo['updatetime']|date="Y-m-d H:i",###}<else/>-</if>
</td>

<td>
{$vo["remark"]}
</td>

<td class="td-manage">
  <if condition="$vo['status'] eq 1 ">
    <a title="同意退款" class="layui-btn layui-btn-xs"  onclick="setStatus(this,'{$vo['id']}','{:U('is_AgreeRefund')}')" href="javascript:;">
      同意退款
    </a><br><br>
    <a title="拒绝退款" class="layui-btn layui-btn-xs"  onclick="setStatus(this,'{$vo['id']}','{:U('not_AgreeRefund')}')" href="javascript:;">
      拒绝退款
    </a>    
  </if>
</td>
</tr>
</volist>
<!--<tr>-->
<!--<td>-->
<!--<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>-->
<!--</td>-->
<!--<td>2017009171822298053</td>-->
<!--<td>老王:18925139194</td>-->
<!--<td>7829.10</td>-->
<!--<td>7854.10</td>-->
<!--<td>待确认</td>-->
<!--<td>未支付</td>-->
<!--<td>未发货</td>-->
<!--<td>其他方式</td>-->
<!--<td>申通物流</td>-->
<!--<td>2017-08-17 18:22</td>-->
<!--<td class="td-manage">-->
<!--<a title="查看"  onclick="x_admin_show('编辑','{:U('edit',array('id'=>$vo['id']))}')" href="javascript:;">-->
<!--<i class="layui-icon">&#xe63c;</i>-->
<!--</a>-->
<!--<a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">-->
<!--<i class="layui-icon">&#xe640;</i>-->
<!--</a>-->
<!--</td>-->
<!--</tr>-->
</tbody>
</table>
<div class="page">
  {$page}
</div>
</div>

<script>

  $(function () {
      var searchurl = "{:U('refundindex')}";
      $('#search').click(function () {

          $('form').attr('action',searchurl);
      });

      var exporturl = "{:U('exportorder')}";
      
      $('#export').click(function () {

          $('form').attr('action',exporturl);
      });
  })

    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });
  
  	/*线路改变获取小区操作*/
	layui.use(['layer', 'form'], function(){
		    var layer = layui.layer,form = layui.form;
		    form.on('select(quyu_id)', function(data){
		    $.ajax({
				  type: 'POST',
				  url: '{:U("getXiaoqu")}',
				  data: {quyu_id:data.value},
				  dataType:  'json',
				  success: function(data){
					  $("#xiaoqu_id").empty();
					  if(data.retCode=="0000"){
						  $("#xiaoqu_id").append(data.data);
						  form.render();
					  }else{
						  alert(data.retDesc);
					  }
			     }
		    });
		});
	});
  	
  	/*批量发货操作*/
    function issetAll(argument,url){
	    var data = tableCheck.getData();
	    
	    layer.confirm('确认批量发货操作吗？',function(index){

	        if(data == false || data=='undefined'){
	            layer.msg('参数错误',{icon:5});
	            return false;
	        }
	        $.post(url,{id:data},function (res) {
	            if(res.code){
	                layer.msg(res.msg,{icon:5});
	            }else{

	                layer.msg('操作成功', {icon: 1});
	                location.replace(location.href);
	            }

	        })

	    });
 }


    /*用户-删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            //发异步删除数据
            $(obj).parents("tr").remove();
            layer.msg('已删除!',{icon:1,time:1000});
        });
    }






<!--
function delAllxxx (argument) {

    var data = tableCheck.getData();

    layer.confirm('确认要删除吗？'+data,function(index){
        //捉到所有被选中的，发异步进行删除
        layer.msg('删除成功', {icon: 1});
        $(".layui-form-checked").not('.header').parents('tr').remove();
    });
}
-->
</script>

<include file="Public/footer"/>